<style>
.btn.btn-danger-o {
    background: transparent;
    color: {{main.syscolor || '#7c1cc9'}};
    border: 1px solid {{main.syscolor || '#7c1cc9'}};
}
</style>
<div class="fui-page fui-page-current page-goods-list" style="background: {{main.syscolor || '#7c1cc9'}};">
<div class='fui-content' style="top:0;background:none;padding-bottom:0">
	<div style="padding:2rem;margin-top:1rem">
		<div class="top" style="margin-bottom:-1.3rem;z-index:108">
			<div class="c">
					<img style="width:3rem;height:3rem;border-radius:100%" src="{{tomedia(pagedata.c.logo) || '../core/resource/images/no-wxapp.png'}}"  />
			</div>
		</div>
		<div class="fui-code" style="background: linear-gradient(#fdf5d8, #fcd7f7);border-radius: 0.5rem;padding-bottom:1rem">		
			 <div class="fui-line-title" style="padding-top:1.3rem">
					<div class="bold">{{pagedata.c.title}}</div>
					<a href="javascript:;" href="tel:{{pagedata.c.mobile}}"  style="color:#999;font-size:0.7rem">收银电话：{{pagedata.c.mobile}} <i class="icon icon-phone" style="font-size:0.6rem"></i></a>
			</div>
			<div class="fui-cell-group" style="padding:0.5rem;background:none">
				<div class="fui-cell-title bold c" style="font-size:0.9rem">
						{{pagedata.title}}
				</div>
				<div class="fui-cell">
						<div class="fui-cell-label">支付金额：</div>
						<div ng-if="pagedata.money<=0" class="fui-cell-info">
							<input type="member" ng-change="pagedata.getupfee();"; placeholder="请输入支付金额" class="fui-input bold" style="font-size:1rem" ng-model="pagedata.paymoney" />
						</div>
						<div ng-if="pagedata.money>0" class="fui-cell-info bold" style="font-size:0.8rem">{{pagedata.money}} 元</div>
				</div>
				<div ng-if="pagedata.upfee.jianfee1>0" class="fui-cell">
						<div class="fui-cell-label">随机立减：</div>
						<div class="fui-cell-info">{{pagedata.upfee.jianfee1}} 元</div>
				</div>
				<div ng-if="pagedata.upfee.jianfee2>0" class="fui-cell">
						<div class="fui-cell-label">满额立减：</div>
						<div class="fui-cell-info">{{pagedata.upfee.jianfee2}} 元</div>
				</div>
				<div ng-if="pagedata.upfee.discount>0" class="fui-cell">
						<div class="fui-cell-label">固定折扣：</div>
						<div class="fui-cell-info">{{pagedata.upfee.discount}}%</div>
				</div>
				<div ng-if="pagedata.upfee.lastfee>0" class="fui-cell">
						<div class="fui-cell-label">最终支付：</div>
						<div class="fui-cell-info bold" style="font-size:1rem">{{pagedata.upfee.lastfee}} 元</div>
				</div>
			</div>
			<div class="content-empty" style="margin-top:0.5rem;">
				<a href="javascript:" id="showTooltips" ng-click="pagedata.pay()" class="weui_btn weui_btn_primary" style="border-radius: 1rem;width:  9rem;font-size: .75rem">
					立即支付
				</a>
			</div>
		</div>
		</div>
	</div>
</div>
<script type="text/javascript">
//购买
scope.pagedata.pay=function(){
	scope.post_json('/pay/get/',{'qrid':scope.pagedata.qrid,'paymoney':scope.pagedata.paymoney},function(res){
			if(res.payid){
				require(['tool'],function(tool){
					tool.pay(res.payid,function(res){
						if(res.type=='success'){
							scope.message('支付成功！','','jy_weishop/index/');
						}else{
							scope.message('支付失败！失败原因：'+res.message,'error');
						}
					});
				});
			}
	});
	
}
scope.pagedata.getupfee=function(){
	if(scope.pagedata.paymoney){
		var money=scope.pagedata.paymoney
	}else{
		var money=scope.pagedata.money
	}
	scope.get('jy_cashier/pay/upfee/money='+money,function(res){
		scope.pagedata.upfee=res
		console.log('scope.pagedata.upfee');console.log(res);
		scope.$evalAsync();
	});
}
if(scope.pagedata.money>0){
	scope.pagedata.getupfee();
}
</script>